# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=gojq
pkgver=0.12.8
pkgrel=0
pkgdesc="Pure Go implementation of jq"
url="https://github.com/itchyny/gojq"
license="MIT"
arch="all"
makedepends="go"
subpackages="$pkgname-zsh-completion"
source="https://github.com/itchyny/gojq/archive/v$pkgver/gojq-$pkgver.tar.gz"

export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
export GOPATH="$srcdir"
export CGO_ENABLED=0

build() {
	go build -ldflags "-s -w" ./cmd/gojq
}

check() {
	go test ./...
}

package() {
	install -Dm755 gojq -t "$pkgdir"/usr/bin

	install -Dm644 _gojq -t "$pkgdir"/usr/share/zsh/site-functions
}

sha512sums="
079573d0fab28abbbd66ea256544b06927a5739e25faf2cc2f3172bedfbfd60f8ac98bed0dfa08b6a31d421f2614603e2943799634383732e7a17300fa9617b4  gojq-0.12.8.tar.gz
"
